﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using D3;
using NYTBD.Modules;
using NYTBD.Common;
using NYTBD.Modules;

namespace NYTBD.Modules
{
    static class Hilda
    {

        private class Guy
        {
            public float X;
            public float Y;
            public string Name;
            public Guy(float x, float y, string name)
            {
                X = x;
                Y = y;
                Name = name;
            }
        }

        private static bool _repairNeeded = false;
        private static bool _shopNeeded = false;

        private static Guy _repairGuy;


        public static bool RepairNeeded()
        {
            return (Pdp11.GetDurabilityInfo() > 0);
        }

        public static void SetRepairGuy()
        {
            //Tashun the Miner
            if (Me.Act == Act.Act1) _repairGuy = new Guy(2894, 2776, "Tashun");
        }


        public static void Shop()
        {
            Game.Print("Shopping");
            foreach (var item in Me.GetContainerItems(Container.Inventory))
            {
                var it = !Blackbeard.EvaluateItem(item);
                if (it) item.SellItem();   
            }
        }

        public static void Repair()
        {
            Game.Print("Repairing");
            Pdp11.RepairAll();
        }

        public static bool ShopNeeded()
        {
            int space = Me.GetContainerItems(Container.Inventory).Aggregate(60, (current, item) => current - item.ItemSizeY);
            return (space <= 30);
        }
    }
}
